/**
 * 动画管理Hook
 */

'use client';

import { useState, useCallback } from 'react';

export interface UseAnimationsReturn {
  /** 是否显示动画 */
  showAnimations: boolean;
  /** 重置动画 */
  resetAnimations: () => void;
}

/**
 * 动画管理Hook
 * @param courseCount 课程数量
 * @returns 动画控制对象
 */
export const useAnimations = (courseCount: number): UseAnimationsReturn => {
  const [showAnimations, setShowAnimations] = useState(true);

  // 重置动画
  const resetAnimations = useCallback(() => {
    setShowAnimations(false);
    setTimeout(() => setShowAnimations(true), 50);
  }, []);

  return {
    showAnimations,
    resetAnimations
  };
};
